package com.icexxx.icemock.mock;

import com.icexxx.icemock.util.IceCactus;
import com.icexxx.icemock.util.IceMockUtil;
import com.icexxx.iceword.IceWordUtil;

import cn.hutool.core.util.RandomUtil;

public class ChineseMock implements IceMock {

	@Override
	public String mock(Integer minVal, Integer maxVal, Integer minWidth, Integer maxWidth, String enums, String key) {
		StringBuilder sb = new StringBuilder();
		if (minWidth == null) {
			minWidth = 1;
		}
		if (maxWidth == null) {
			maxWidth = 5;
		}
		final String wordHoneycomb = IceWordUtil.frequency();
		int wordHoneycombLength = wordHoneycomb.length();
		int width = RandomUtil.randomInt(minWidth, maxWidth + 1);
		String cactus = IceCactus.cactus();
		for (int i = 0; i < width; i++) {
			sb.append(IceMockUtil.genWord(wordHoneycomb, wordHoneycombLength, cactus));
		}
		return sb.toString();
	}



}
